//
//  TYZPageScrollMenuView.h
//  AVfoundationDemo
//
//  Created by TangBin on 2019/8/14.
//  Copyright © 2019 TangBin. All rights reserved.
//

#import <UIKit/UIKit.h>

@class TYZPageConfigration;

NS_ASSUME_NONNULL_BEGIN


@protocol TYZPageScrollMenuViewDelegate <NSObject>
@optional

/**
 点击item

 @param button UIButton
 @param index index
 */
- (void)pageScrollMenuViewItemOnClick:(UIButton *)button index:(NSInteger)index;

/**
 点击Add按钮

 @param button button description
 */
- (void)pageScrollMenuViewAddButtonAction:(UIButton *)button;

@end



/**
 菜单视图
 */
@interface TYZPageScrollMenuView : UIView

@property (nonatomic, strong) UIButton *addButton; ///< 添加按钮

@property (nonatomic, strong) NSMutableArray *titles; ///< 标题数组

+ (instancetype)new UNAVAILABLE_ATTRIBUTE;

- (instancetype)init UNAVAILABLE_ATTRIBUTE;

/**
 初始化

 @param frame 大小
 @param titles 标题数组
 @param config 配置信息
 @param delegate 代理
 @param currentIndex 当前选中下标
 @return return value description
 */
+ (instancetype)pageScrollMenuViewWithFrame:(CGRect)frame titles:(NSMutableArray *)titles configration:(TYZPageConfigration *)config delegate:(nullable id<TYZPageScrollMenuViewDelegate>)delegate currentIndex:(NSInteger)currentIndex;


/**
 根据标题修下标修改标题

 @param title 标题
 @param index index
 */
- (void)updateTitle:(NSString *)title index:(NSInteger)index;

/**
 根据标题数组刷新标题

 @param titles 标题数组
 */
- (void)updateTitles:(NSArray *)titles;

/**
 根据下标调整Item位置

 @param index 下标
 */
- (void)adjustItemPositionWithCurrentIndex:(NSInteger)index;

/**
 根据上个下标和当前点击的下标调整进度

 @param progress progress description
 @param lastIndex 上个下标index
 @param currentIndex 当前下标index
 */
- (void)adjustItemWithProgress:(CGFloat)progress lastIndex:(NSInteger)lastIndex currentIndex:(NSInteger)currentIndex;

/**
 选中下标

 @param index 选中的index
 @param animated animated description
 */
- (void)selectedItemIndex:(NSInteger)index animated:(BOOL)animated;

/**
 调整item

 @param animated animated description
 */
- (void)adjustItemWithAnimated:(BOOL)animated;

/**
 调整item

 @param animate animate description
 */
- (void)adjustItemAnimate:(BOOL)animate;

/**
 刷新视图
 */
- (void)reloadWithView;

/// 更新badge
/// @param badgeValue badgeValue description
/// @param index index description
- (void)updateBadge:(NSInteger)badgeValue index:(NSInteger)index;

@end

NS_ASSUME_NONNULL_END
































